/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021-12-04     Administrator       the first version
 */

#include "IO_Ctrl.h"

#include <rtthread.h>
#include <rtdevice.h>


//USER DEFINE

/* 引脚编号，通过查看设备驱动文件drv_gpio.c确定 */
#ifndef RUN_LED_PIN_NUM
    #define RUN_LED_PIN_NUM            89  /* PF9 */
    #define ERR_LED_PIN_NUM            90  /* PF10 */
#endif

void Run_LED_ON(void *args)
{
    rt_pin_write(RUN_LED_PIN_NUM, PIN_HIGH);
}

void Run_LED_OFF(void *args)
{
    rt_pin_write(RUN_LED_PIN_NUM, PIN_LOW);
}

void Run_LED_Init()
{
    rt_pin_mode(RUN_LED_PIN_NUM, PIN_MODE_OUTPUT);
    rt_pin_write(RUN_LED_PIN_NUM, PIN_HIGH);
}

void Err_LED_Init()
{
    rt_pin_mode(ERR_LED_PIN_NUM, PIN_MODE_OUTPUT);
    rt_pin_write(ERR_LED_PIN_NUM, PIN_HIGH);
}

void Err_LED_ON(void *args)
{
    rt_pin_write(RUN_LED_PIN_NUM, PIN_HIGH);
}

void Err_LED_OFF(void *args)
{
    rt_pin_write(RUN_LED_PIN_NUM, PIN_LOW);
}


//IO init//

void IO_Init()
{
    Run_LED_Init();
    Err_LED_Init();
}


//USER DEFINE
